﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!doctype html>
<html>
<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
	<meta http-equiv="Expires" content="0" />
	<script>
        document.write("<link type='text/css' href='/css/vide/video.css?version=" + new Date().getTime() + "' rel='stylesheet' />");
	</script>
	<style>
		.hide{display:none;}
	</style>
	<script type='text/javascript'>
        var _vds = _vds || [];
        window._vds = _vds;
        (function(){
            _vds.push(['setAccountId', '9c2290a6e6e0e47d']);
            (function() {
                var vds = document.createElement('script');
                vds.type='text/javascript';
                vds.async = true;
                vds.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'assets.growingio.com/vds.js';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(vds, s);
            })();
        })();
	</script>
</head>
<body>
<div class="left" style="width: 100%;height: 100%;">

	<iframe class="contract_iframe" id="iframe1" scrolling="no"   frameborder="0" width="600" height="400"></iframe>
	<%--<iframe class="contract_iframe" id="iframe2" frameborder="0" width="500" height="300"></iframe>--%>
	<%--<iframe class="contract_iframe" id="iframe3" frameborder="0" width="500" height="300"></iframe>--%>
	<%--<iframe class="contract_iframe" id="iframe4" frameborder="0" width="500" height="300"></iframe>--%>
	<%--<iframe class="contract_iframe" id="iframe5" frameborder="0" width="500" height="300"></iframe>--%>


</div>
<div id="divPlugin1" class="plugin1"></div>
</body>
<script src="../js/news/jquery-1.9.1.js"></script>

</html>
<script>
    $.ajax({
        type: 'post',
        url: '/video/selAllVideoDevice',
        dataType: 'json',
        success: function (reg) {
            var data=reg.obj;
            var myArray=new Array();
            for(var i=0;i<data.length;i++){
                var res={
                    ip:data[i].ip,
                    ipAport:data[i].ipAport,
                    userName:data[i].userName,
                    password:data[i].password,
                    streamType:data[i].streamType
				}
                myArray.push(res);
			}
//            if(myArray.length>=5){
                $("#iframe1").attr("src", '/video/video?ip=' + myArray[0].ip + '&ipAport=' + myArray[0].ipAport + '&userName=' + myArray[0].userName + '&password=' + myArray[0].password + '&streamType=' + myArray[0].streamType)
              /*  $("#iframe2").attr("src", '/video/video?ip=' + myArray[1].ip + '&ipAport=' + myArray[1].ipAport + '&userName=' + myArray[1].userName + '&password=' + myArray[1].password + '&streamType=' + myArray[1].streamType)
                $("#iframe3").attr("src", '/video/video?ip=' + myArray[2].ip + '&ipAport=' + myArray[2].ipAport + '&userName=' + myArray[2].userName + '&password=' + myArray[2].password + '&streamType=' + myArray[2].streamType)
                $("#iframe4").attr("src", '/video/video?ip=' + myArray[3].ip + '&ipAport=' + myArray[3].ipAport + '&userName=' + myArray[3].userName + '&password=' + myArray[3].password + '&streamType=' + myArray[3].streamType)
                $("#iframe5").attr("src", '/video/video?ip=' + myArray[4].ip + '&ipAport=' + myArray[4].ipAport + '&userName=' + myArray[4].userName + '&password=' + myArray[4].password + '&streamType=' + myArray[4].streamType)
        */  /*  }*//*else{
                for(var i=0;i<myArray.length;i++){
                    $("#iframe"+i).attr("src", '/video/video?ip=' + myArray[i].ip + '&ipAport=' + myArray[i].ipAport + '&userName=' + myArray[i].userName + '&password=' + myArray[i].password + '&streamType=' + myArray[i].streamType)
                }
            }*/

//            window.setInterval(function () {
//                if(myArray.length>=5){
//                    $("#iframe1").attr("src", '/video/video?ip=' + myArray[1].ip + '&ipAport=' + myArray[0].ipAport + '&userName=' + myArray[0].userName + '&password=' + myArray[0].password + '&streamType=' + myArray[0].streamType)
//                    $("#iframe2").attr("src", '/video/video?ip=' + myArray[2].ip + '&ipAport=' + myArray[1].ipAport + '&userName=' + myArray[1].userName + '&password=' + myArray[1].password + '&streamType=' + myArray[1].streamType)
//                    $("#iframe3").attr("src", '/video/video?ip=' + myArray[3].ip + '&ipAport=' + myArray[2].ipAport + '&userName=' + myArray[2].userName + '&password=' + myArray[2].password + '&streamType=' + myArray[2].streamType)
//                    $("#iframe4").attr("src", '/video/video?ip=' + myArray[4].ip + '&ipAport=' + myArray[3].ipAport + '&userName=' + myArray[3].userName + '&password=' + myArray[3].password + '&streamType=' + myArray[3].streamType)
//                    $("#iframe5").attr("src", '/video/video?ip=' + myArray[0].ip + '&ipAport=' + myArray[4].ipAport + '&userName=' + myArray[4].userName + '&password=' + myArray[4].password + '&streamType=' + myArray[4].streamType)
//                }else{
//					for(var i=0;i<myArray.length;i++){
//                        $("#iframe"+(i+1)).attr("src", '/video/video?ip=' + myArray[i].ip + '&ipAport=' + myArray[i].ipAport + '&userName=' + myArray[i].userName + '&password=' + myArray[i].password + '&streamType=' + myArray[i].streamType)
//                    }
//				}
//				var first=myArray.shift(myArray[0])
//				myArray.push(first);
//				console.log(myArray);
//			}, 20000);

        }
    })
</script>